﻿@model QuanLyGiaoVuUI.Models.MonHoc.CapNhatMonHocViewModel

@using QuanLyGiaoVuUI.Helpers;
@{
    Layout = null;
}

<script src="~/Scripts/jquery.validate.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.js"></script>

<style>
    .editor-label {
        text-align: left !important;
        width: 200px;
    }

    .hidden {
        display: none;
    }
</style>

            @{Html.EnableClientValidation();}
            @using (Ajax.BeginForm("CapNhat", "MonHoc", new AjaxOptions { HttpMethod = "POST" }))
            {
                    
                @Html.ValidationSummary(true)
                @Html.HiddenFor(model => model.ID)

                <div id="tab-chung">
                    <table class="form" border="0" cellpadding="0" cellspacing="0" id="id-form">
                        <tr>
                            <th  class="editor-label" valign="top">@Html.LabelFor(model => model.MaMonHoc)</th>
                            <td class="editor-field">@Html.TextBoxFor(model => model.MaMonHoc, new { @class = "inp-form" })
                                <div>@Html.MyValidationMessageFor(model => model.MaMonHoc)</div>
                            </td>
                            
                        </tr>
                        <tr>
                            <th class="editor-label" valign="top">@Html.LabelFor(model => model.TenMonHoc)</th>
                            <td>
                                <div class="editor-field">
                                    @Html.TextBoxFor(model => model.TenMonHoc, new { @class = "inp-form" })
                                </div>
                            <div>@Html.MyValidationMessageFor(model => model.TenMonHoc)</div>
                                </td>
                        </tr>
                        <tr>
                            <th class="editor-label" valign="top">@Html.LabelFor(model => model.TongSoTinChi)</th>
                            <td class="editor-field">@Html.TextBoxFor(model => model.TongSoTinChi, new { @class = "inp-form" })
                                <div>@Html.MyValidationMessageFor(model => model.TongSoTinChi)</div>
                            </td>
                            
                        </tr>
                        <tr>
                            <th class="editor-label" valign="top">@Html.LabelFor(model => model.SoTinChiLyThuyet)</th>
                            <td class="editor-field">@Html.TextBoxFor(model => model.SoTinChiLyThuyet, new { @class = "inp-form" })
                                <div>@Html.MyValidationMessageFor(model => model.SoTinChiLyThuyet)</div>
                            </td>
                        </tr>
                        <tr>
                            <th class="editor-label" valign="top">@Html.LabelFor(model => model.HocKy)</th>
                            <td class="editor-field">@Html.TextBoxFor(model => model.HocKy, new { @class = "inp-form" })
                            <div>@Html.MyValidationMessageFor(model => model.HocKy)</div>
                            </td>
                        </tr>
                        <tr>
                            <th class="editor-field">@Html.CheckBoxFor(model => model.MonTuChon, new { @class = "inp-form" })
                            @Html.LabelFor(model => model.MonTuChon)</th>
                        </tr>
                        <tr id="MaMonChinhHolder">
                            <th class="editor-label" valign="top">@Html.LabelFor(model => model.MaMonChinh)</th>
                            <td class="editor-field">@Html.DropDownList("MaMonChinh", new SelectList(Model.DanhSachMonHocChinh, "ID", "MaVaTenMonHoc"), new { @class = "styledselect_form_1" })</td>
                        </tr>
                    </table>
                    <div>
                        <input type="submit" id="btnSubmitForm" style="display: none"/>
                    </div>
                </div>
            }
            <!-- end id-form  -->

            <div class="clear"></div>

<script>
    $(document).ready(function () {
        $("#TongSoTinChi").spinner({
            min: 0,
            max: 10
        });
        $("#SoTinChiLyThuyet").spinner({
            min: 0,
            max: 10
        });

        $("#MaMonChinhHolder").addClass("hidden");

        $("#MonTuChon").bind("change", function () {
            if (!$(this).is(":checked")) {
                if (!$("#MaMonChinhHolder").hasClass("hidden"))
                    $("#MaMonChinhHolder").addClass("hidden");
            }
            else {
                $("#MaMonChinhHolder").removeClass("hidden");
            }
        });
    });

    var CapNhatMonHoc = new function () {
        this.SubmitForm = function () {
            $("#btnSubmitForm").click();
        }
    }
</script>
